package com.slz3.business.module.memberManagement.drawTicket.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.drawTicket.domain.DrawTicket;
import com.slz3.business.module.memberManagement.drawTicket.domain.DrawTicketFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class DrawTicketTransactionalServiceImpl implements DrawTicketTransactionalService {

    @Override
    public DrawTicket modify(DrawTicket drawTicketNew) {
        Repositorys.drawTicket.test();
        Repositorys.drawTicket.save(DrawTicketFactory.initBaseFields());
        System.err.println(1/0);
        drawTicketNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.drawTicket.saveAndFlush(drawTicketNew);
    }

    @Override
    public List<DrawTicket> batchModify(List<DrawTicket> drawTicketList) {
        return Repositorys.drawTicket.saveAll(drawTicketList);
    }
}
